import { createStore } from "vuex";
// 导入vuex持久化存储插件
import createPersistedState from "vuex-persistedstate";

import cart from "@/store/modules/cart";
import category from "@/store/modules/category";
import user from "@/store/modules/user";

// 创建vue3.x store: createStore();
export default createStore({
    // 分模块
    modules: {
        cart,
        category,
        user
    },
    // Vuex的插件配置
    plugins: [
        createPersistedState({
            // 本地存储的名称
            key: "eribbit-client-pc-store",
            // 需要本地存储的模块
            paths: ["user", "cart"]
        })
    ]
});
